if (String.prototype.trim === undefined) {
    /**
     * String.trim
     * @returns {string}
     */
    String.prototype.trim = function() {
        return this.replace(/(^\s+)|(\s+$)/g, '');
    };
};
if (String.prototype.startsWith === undefined) {
    /**
     * String.startWiths
     * @param s
     * @returns {boolean}
     */
    String.prototype.startsWith = function(s) {
        return (this.match('^' + s) == s);
    };
};
if (String.prototype.endsWith === undefined) {
    /**
     * String.endsWiths
     * @param s
     * @returns {boolean}
     */
    String.prototype.endsWith = function(s) {
        return (this.match(s + '$') == s);
    };
};
if (String.prototype.format === undefined) {
    /**
     * String.format
     * @returns {String}
     */
    String.prototype.format = function() {
        var s = this;
        for (var i = 0; i < arguments.length; i ++) {
            s = s.replace('%s', arguments[i]);
        }
        return s;
    };
};
if (String.prototype.encode === undefined) {
    /**
     * String.encode
     * @returns {string}
     */
    String.prototype.encode = function() {
        return encodeURIComponent(this);
    };
};
if (String.prototype.decode === undefined) {
    /**
     * String.decode
     * @returns {string}
     */
    String.prototype.decode = function() {
        return decodeURI(this.replace(/\+/g, ' ')
            .replace(/%23/gi, '#').replace(/%24/gi, '$')
            .replace(/%26/gi, '&').replace(/%2B/gi, '+')
            .replace(/%2C/gi, ',').replace(/%2F/gi, '/')
            .replace(/%3A/gi, ':').replace(/%3B/gi, ';')
            .replace(/%3D/gi, '=').replace(/%3F/gi, '?')
            .replace(/%40/gi, '@')
        );
    };
};
if (Array.prototype.indexOf === undefined) {
    /**
     * Array.indexOf
     * @param o
     * @returns {number}
     */
    Array.prototype.indexOf = function(o) {
        for (var i = 0; i < this.length; i ++) {
            if (this[i] == o) { return i; }
        }
        return -1;
    };
};
if (Array.prototype.itemDel === undefined) {
    /**
     * Array.itemDel
     * @param o
     * @returns {Array}
     */
    Array.prototype.itemDel = function(o) {
        var i = this.indexOf(o);
        if (i > -1) { this.splice(i, 1); }
        return this;
    };
};